package pyf.demo;

/**
 * @author pengyifeng
 * @version 5.1
 * @ClassName TestThreadDemo02.java
 * @Description 多线程方式2 实现Runnable
 * @createTime 2021年07月26日 18:21:00
 */
public class TestThreadDemo02 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+"运行:"+i);
        }
    }

    public static void main(String[] args) {

        new Thread(new TestThreadDemo02(),"线程01").start();
        new Thread(new TestThreadDemo02(),"线程02").start();
        new Thread(new TestThreadDemo02(),"线程03").start();
        for (int i = 0; i < 100; i++) {
            System.out.println("主线程运行:"+i);
        }
    }
}
